package com.aya.activity.shop.fullmoney;

import com.aya.activity.core.ShopGoodsPriceActivity;
import com.aya.activity.core.model.Goods;

import java.math.BigDecimal;

/**
 * 满额减
 */
public class FullMoney implements ShopGoodsPriceActivity {

    FullMoneyService goodsFullMoney;

    public void setGoodsFullMoney(FullMoneyService goodsFullMoney) {
        this.goodsFullMoney = goodsFullMoney;
    }

    @Override
    public <T> BigDecimal activity(T shopId, Goods goods, BigDecimal price) {
        BigDecimal cutMoney = goodsFullMoney.getCutMoney(goods);
        return price.subtract(cutMoney);
    }
}
